<?php
namespace app\common\audit\model;

use app\common\system\logic\UserLogic;
use think\Model;
use think\model\concern\SoftDelete;

class AuditComment extends Model
{
    use SoftDelete;
    protected $defaultSoftDelete = 0;

    protected $type = [
        'image' => 'json',
    ];

    public function getImageAttr($value){
        return empty($value) ? [] : json_decode($value, true);
    }

    public function getUserAttr($value, $data) {
        $userLogic = new UserLogic();
        return $userLogic->getUser($data['user_id'], ['id', 'realname', 'status']);
    }
}